<?php
/**
 * 酒店每日房型状态控制
 * User: lxq
 * Date: 2018/5/11
 * Time: 9:51
 */
defined('InNcPHP') or exit('Access Invalid!');

class hotel_dateModel extends  Model {

    public function __construct(){
        parent::__construct('hotel_date');
    }

    /**
     * 获取列表分页
     * @param array $condition
     * @param string $field
     * @param int $page
     * @param string $order
     * @return mixed
     */
    public function getHotelDateListPage($condition = array(), $field = '*', $page = 0, $order = 'date desc'){
        return $this->field($field)->where($condition)->page($page)->order($order)->select();
    }

    /**
     * 获取一条记录的详细信息
     * @param array $condition
     * @param string $field
     * @return mixed
     */
    public function getHotelDateInfo($condition = array(), $field = '*')
    {
        return $this->field($field)->where($condition)->find();
    }

    /**
     * 插入记录
     * @param array $params
     * @return mixed
     */
    public function addHotelDate($params)
    {
        return $this->insert($params);
    }

    /**
     * 更新记录
     * @param array $condition
     * @param array $params
     * @return mixed
     */
    public function updateHotelDate($condition, $params)
    {
        return $this->where($condition)->update($params);
    }

    /**
     * 删除记录
     * @param array $condition
     * @return mixed
     */
    public function delHotelDate($condition){
        return $this->where($condition)->delete();
    }


    /**
     * 获取记录数组
     * @param array $condition
     * @param string $field
     * @param string $order
     * @return mixed
     */
    public function getHotelDateList($condition = array(), $field = '*', $order = 'date desc'){
        return $this->field($field)->where($condition)->order($order)->select();
    }
}